home *** CD-ROM | disk | FTP | other *** search
- /* PedestalDemoMain.cc */
-
- #include "Ped1ObjectDeity.hh"
- #include "Ped1AppProcess.hh"
- #include "PedApplication.hh"
-
- // For HelloAgent
- #include "PedAgent.hh"
- #include "PedWindow.hh"
- #include "PedPaneSubView.hh"
- #include "PedViewScrollerSimple.hh"
- #include "PedViewScroll.hh"
- #include "PedPaneIconAnimated.hh"
- #include "PedScrollbar.hh"
-
-
- // HelloAgent
- // ----------
-
- class HelloAgent : public PedAgent {
- public:
- HelloAgent(PedTask *inParent) : PedAgent(inParent) {}
- virtual ~HelloAgent() {}
-
- virtual void InitWindow();
- };
-
-
- void
- HelloAgent::InitWindow()
- {
- if (!mWindow) {
- mWindow = new PedWindow(this);
-
- //Rect rect = {18, 0, 18+2*4+11*25+16, 2*4+6*80+16};
- Rect rect = {18, 0, 18+128+15, 128+15};
- short mbarHeight = ::GetMBarHeight();
- short vMargin = (qd.screenBits.bounds.bottom - rect.bottom) - mbarHeight;
- short hMargin = (qd.screenBits.bounds.right - rect.right);
- ::OffsetRect(&rect, hMargin / 2, mbarHeight + vMargin / 3);
-
- // Set the bounds before creating the pane, because things aren't
- // perfect yet and the pane will be sized to the old bounds.
- mWindow->SetBounds(rect);
- mWindow->SetTitle("\pHello");
-
- PedPaneSubView *top = new PedPaneSubView(*mWindow);
- mWindow->SetPane(top);
- top->release();
-
- PedViewScrollerSimple *scroller = new PedViewScrollerSimple(*top);
- top->SetSubView(scroller);
- scroller->release();
- scroller->SetScrollbarPresence(kPedScrollVertical + kPedScrollHorizontal, true);
-
- PedPaneIconAnimated *iconpane = new PedPaneIconAnimated(*scroller->ScrollView());
- scroller->SetPane(iconpane);
- iconpane->release();
-
- // Remember the rule -- every new/retain must be balanced!
- // (We retain and store the window when it calls PedAgent::SetWindow().)
- mWindow->release();
- }
- }
-
- // HelloClassAgent
- // ---------------
-
- class HelloClassAgent : public PedClassAgent {
- public:
- HelloClassAgent(PedTask *inPrimaryTask) : PedClassAgent(inPrimaryTask) {}
- virtual PedAgent *MakeAgent();
- //PedAgent *MakeInstance() {return MakeAgent();}
- };
-
- PedAgent *
- HelloClassAgent::MakeAgent()
- {
- HelloAgent *agent = new HelloAgent(mPrimaryTask);
- agent->autorelease();
-
- return agent;
- }
-
- // main
- // ----
-
- int main(void)
- {
- Ped1AppProcess aProcess;
-
- aProcess.Init();
-
- PedApplication app;
- HelloClassAgent agentClass(&app);
- //gOD->RegisterClass('Agnt', agentClass);
- //gOD->RegisterFabricator('Agnt', &MakeAgent);
- gOD->RegisterAgentClass(&agentClass);
-
- aProcess.Call(app);
-
- return 0;
- }
-